package com.mygdx.canyonbunny.object;

import com.badlogic.gdx.math.Vector2;
import com.mygdx.canyonbunny.util.AssetLoader;

public class Horse {

	private int width;
	private int height;
	private Vector2 position;
	private Vector2 acceleration;
	private Vector2 velocity;
	private int flat;

	public Horse(int x, int y, int width, int height) {
		this.width = width;
		this.height = height;
		position = new Vector2(x, y);
		velocity = new Vector2(0, 0);
		acceleration = new Vector2(0, 460);
		flat = y;
	}

	public void update(float delta) {
		velocity.add(acceleration.cpy().scl(delta));
		position.add(velocity.cpy().scl(delta));
		if (position.y > flat)
			position.y = flat;
	}

	public float getX() {
		return position.x;
	}

	public float getY() {
		return position.y;
	}

	public float getWidth() {
		return width;
	}

	public float getHeight() {
		return height;
	}

	public void onClick() {
		AssetLoader.jump.play();
		velocity.y = -140;
	}

}
